package solver.moves;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

import util.ObjectIdPropertyPair;

import model.IncrementalCostCalculator;
import model.IncrementalValidator;
import model.MachineSelector;
import model.SolverEnvironment;
import model.Problem;
import model.Solution;

import command.Invoker;

public class WorstMachinePairBestProcessExchange extends RandomMachinePairBestProcessExchangeMove {

	MachineSelector ms;
	
	public WorstMachinePairBestProcessExchange(SolverEnvironment env, MachineSelector ms) {
		super(env);
		this.ms = ms;
	}

	@Override
	protected void selectMachinePair() {
//		orig_m1_index = random.nextInt(problem.M);
		orig_m1_index = ms.selectMostLoadedMachine(getRandom().nextInt(Math.min(Math.max(getProblem().M/10,1),1+getRandom().nextInt(4)))+1);
//		orig_m2_index = getRandom().nextInt(problem.M);
		orig_m2_index = ms.selectMostLoadedMachine(getRandom().nextInt(Math.min(Math.max(getProblem().M/10,1),1+getRandom().nextInt(10)))+1);
//		orig_m2_index = ms.selectLeastLoadedMachine(getRandom().nextInt(Math.min(Math.max(problem.M/10,1),20))+1);
		
		while(orig_m1_index==orig_m2_index)
			orig_m2_index = getRandom().nextInt(getProblem().M);
	}
}
